/*
 =============================================================================
 FILE...............: Receipt.java
 COMMENTS...........: Model of an electronic receipt.
 =============================================================================
 AUTHOR(S)..........: Everton Ranielly de Sousa Cavalcante
 					  Department of Informatics and Applied Mathematics
 					  Federal University of Rio Grande do Norte
 LAST MODIFICATION..: September 16th, 2012
 ============================================================================= 					  
*/


/* ========================================================================= */
/* PACKAGES			                                                         */
/* ------------------------------------------------------------------------- */
package model;


/* ========================================================================= */
/* CLASS Receipt	                                                         */
/* ------------------------------------------------------------------------- */
/**
 * Model of an electronic receipt
 * @author Everton Cavalcante
 */
public class Receipt 
{
	private String code;		// 12-digit receipt code
	private Booking booking;	// Flight booking
	
	
	/** Default constructor */
	public Receipt()
	{ /* Empty */ }
	
	
	/**
	 * Constructor
	 * @param code Receipt code
	 * @param booking Flight booking
	 */
	public Receipt(String code, Booking booking) 
	{
		this.code = code;
		this.booking = booking;
	}


	/**
	 * Returns the 12-digit receipt code
	 * @return Receipt code
	 */
	public String getCode() 
	{ return code; }


	/**
	 * Modifies the receipt code
	 * @param code 12-digit code to set
	 */
	public void setCode(String code) 
	{ this.code = code; }


	/**
	 * Returns the reference to the flight booking regarding the receipt
	 * @return Reference to the flight booking regarding the receipt
	 */
	public Booking getBooking() 
	{ return booking; }


	/**
	 * Modifies the reference to the flight booking regarding the receipt
	 * @param booking Reference to the flight booking regarding the receipt
	 */
	public void setBooking(Booking booking) 
	{ this.booking = booking; }
	
	
	@Override
	public String toString()
	{
		String contents = "";
		contents += "PURCHASE INFORMATION:\n";
		contents += "Electronic receipt code: " + this.getCode() + "\n\n";
		contents += this.getBooking().toString();
		
		return contents;
	}
}
